package firewall;
public class ReglaGeneralIp extends Regla {
	
	private long ipOrigenPiso;
	private long ipOrigenTecho;
	private long ipDestinoPiso;
	private long ipDestinoTecho;
	
	public void setIpOrigenPiso(String ip){
						
		this.ipOrigenPiso= Long.parseLong(ip.replaceAll("\\D", ""));
	}
	public void setIpOrigenTecho(String ip){
		this.ipOrigenTecho=Long.parseLong(ip.replaceAll("\\D", ""));
	}
	
	
	public void setIpDestinoPiso(String ip){
		
		this.ipDestinoPiso=Long.parseLong(ip.replaceAll("\\D", ""));
	}
	public void setIpDestinoTecho(String ip){
		this.ipDestinoTecho=Long.parseLong(ip.replaceAll("\\D", ""));
	}
	
	
	
	public long getIpOrigenPiso(){
		return this.ipOrigenPiso;
	}
	
	public long getIpOrigenTecho(){
		return this.ipOrigenTecho;
	}
	
	public long getIpDestinoPiso(){
		return this.ipDestinoPiso;
	}
	
	public long getIpDestinoTecho(){
		return this.ipDestinoTecho;
	}
	
	
	
	public boolean matchea(Paquete paquete){
	return ((paquete.getIpOrigen() <= this.ipOrigenTecho && paquete.getIpOrigen() >= this.ipOrigenPiso) || (paquete.getIpDestino() <= this.ipDestinoTecho && paquete.getIpDestino() >= this.ipDestinoPiso) ); //TODO a Int
	}

}
